# -*-* encoding:UTF-8 -*-
# author : mengy
# date   : 2018/11/21

import socket

s = socket.socket()
host = socket.gethostname()
print "主机:", host
port = 8000

s.connect((host, port))
while True:
    recv_msg = s.recv(1024)
    if recv_msg != "":
        print "服务端消息:", recv_msg
    send_msg = raw_input("请输入要发送的消息:")
    s.send(send_msg)
    if send_msg == 'bye':
        print "会话结束！"
        s.close()
        break
